import { createRouter, createWebHashHistory } from 'vue-router'
import DefaultLayout from '../layouts/default/index.vue'
import smallLayout from "../layouts/default/smallLayout.vue"
export const routes = [
  // { path: "/", component: () => import("../view/home.vue") },
  // { path: "/about", component: () => import("../views/about.vue") },
  // { path: "/list", component: () => import("../views/list/index.vue") },
  // { path: "/home", component: () => import("../views/about.vue") },
  {
    path: '/',
    name: 'DefaultLayout',
    redirect: '/home',
    component: DefaultLayout,
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/home.vue'),
      },
      {
        path: '/about',
        name: 'about',
        component: () => import('../views/about.vue'),
      },
      {
        path: '/list',
        name: 'list',
        component: () => import('../views/list/index.vue'),
      },
      {
        path: '/slotview',
        name: 'slotview',
        component: smallLayout,
        children: [
          {
            path: 'slotdemo1',
            name: 'slotdemo1',
            component: () => import('../views/slotView/slotdemo1.vue'),
            meta: { title: '插槽' },
          },
          {
            path: 'slotdemo2',
            name: 'slotdemo2',
            component: () => import('../views/slotView/slotdemo2.vue'),
            meta: { title: '具名插槽' },
          },
        ],
      },

    ],
  },
]

export const router = createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
  history: createWebHashHistory(),
  routes, // `routes: routes` 的缩写
})
